import VNode from './VNode';

export const h = function (
  tag: string,
  props: Record<string, any> = {},
  children: Array<VNode> | string | null = [],
  key = null
) {
  if (typeof children === 'string' || typeof children === 'number') {
    return new VNode(tag, props, [], key, (children as string | number).toString());
  }
  return new VNode(tag, props, children, key);
};
